use std::thread;
use std::time::Duration;

fn hello(main_thread: bool) {
    let i:i32 = 5;
    let s  = String::from("abc");
    println!("is_main_thread:{main_thread}, s:{s}, s ptr:{:p} s as_ptr:{:p}", &s, s.as_ptr());
    println!("is_main_thread:{main_thread}, i:{i}, i ptr:{:p}", &i);

}

fn main() {
    for _i in 1..3 {
        thread::spawn(|| {
            hello(false);
        });
    }

    for _i in 1..3 {
        hello(true);
    }
    thread::sleep(Duration::from_secs(1));
}